<template>
    <div id='tmpl'>
        <!--利用mui的图文表格组件实现-->
        <div class="mui-content" style="background-color:#fff">
            <ul class="mui-table-view mui-grid-view">
                <li v-for='(item,index) in list' :key='index' class="mui-table-view-cell mui-media mui-col-xs-6">
                    <router-link v-bind="{to:'/goods/goodsinfo/'+item.id}">
                        <img class="mui-media-object" :src="item.img_url">
                        <div class="mui-media-body">{{item.title}}</div>
                        <div class="desc">
							<p>
								<span>￥{{item.sell_price}}</span>
								<s>￥{{item.market_price}}</s>
							</p>
							<p>
                                <h6 class="left">热卖中</h6>
                                <h6 class="right">剩余{{item.stock_quantity}}件</h6>
							</p>
						</div>
                    </router-link>
                </li>
            </ul>
        </div>
    </div>
</template>
<script>

export default {
    data() {
        return {
            list:[]
        }
    },
    created(){
        this.getgoodslist();
    },
    methods:{
        getgoodslist(){
            //http://www.lovegf.cn:8899/api/getgoods?pageindex=1
            var url = this.$common.apidomain+'/api/getgoods?pageindex='+1;
            this.$http.get(url).then(function(response){
                var data = response.body;
                if(data.status !== 0){
                    this.$tip(data.message);
                    return;
                }
                this.list = data.message;
            })
        }
    }
}
</script>
<style scoped>
.mui-table-view.mui-grid-view .mui-table-view-cell {
    border: 1px solid rgba(0, 0, 0, 0.4);
    -webkit-box-shadow: 0 0 4px #000;
    -moz-box-shadow: 0 0 4px #000;
    box-shadow: 0 0 4px #000;
    margin-left: 4px;
    padding-left: 0px;
}

#mui-content .mui-media-body {
    color: #0094ff;
}

.mui-table-view.mui-grid-view .mui-table-view-cell .desc {
    height: 60px;
    background-color: rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    padding: 5px;
    text-align: left;
}

.mui-table-view.mui-grid-view .mui-table-view-cell .desc span {
    color: red;
    margin-right: 15px;
    margin-left: 15px;
}

.mui-table-view.mui-grid-view .mui-table-view-cell a {
    padding-left: 0px;
    margin-left: 0px;
}

.mui-table-view.mui-grid-view .mui-table-view-cell .right {
    position: absolute;
    right: 10px;
    bottom: 0px;
}

.mui-table-view.mui-grid-view .mui-table-view-cell .desc .left {
    position: absolute;
    left: 20px;
    bottom: 0px;
}
</style>